<!DOCTYPE html>
<html class="x-admin-sm">
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>欢迎页面-X-admin2.2</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
    <link rel="stylesheet" href="/css/font.css">
    <link rel="stylesheet" href="/css/xadmin.css">
    <script src="../lib/layui/layui.js" charset="utf-8"></script>
    <script type="text/javascript" src="../js/xadmin.js"></script>
    <script type="text/javascript" src="../js/jquery.min.js"></script>
    <!--[if lt IE 9]>
    <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
    <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
</head>
<body>
<div class="x-nav">
          <span class="layui-breadcrumb">
            <a >首页</a>
            <a>评论管理</a>
            <a>
              <cite>评论列表</cite></a>
          </span>
    <a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right" onclick="location.reload()" title="刷新">
        <i class="layui-icon layui-icon-refresh" style="line-height:30px"></i></a>
</div>
<div class="layui-fluid">
    <div class="layui-row layui-col-space15">
        <div class="layui-col-md12">
            <div class="layui-card">
                <div class="layui-card-body ">
                    <table class="layui-hide" id="test" lay-filter="demo"></table>
                </div>
            </div>
        </div>
    </div>
</div>
<input type="hidden" id="mid" th:value="${#httpSession.getAttribute('mid')}">
</body>
<script>
    var mid = $('#mid').val();
    layui.use([ 'form', 'table', 'rate'],
        function () {
            var
                table = layui.table,
                form = layui.form,
                rate = layui.rate;

            table.render({
                elem: '#test'
                , url: '/review/selReviewList'//数据接口
                , cols: [
                    [ //表头
                        {field: 'orderId', title: '订单号', width: 150, align: 'center'},
                        {field: 'service', title: '服务评分', width: 165, align: 'center',templet: function (res) {
                                return '<div id="service'+(res.LAY_TABLE_INDEX)+'" style="line-height: 1px"></div>'
                        }},
                        {field: 'orders', title: '点单评分', width: 165, align: 'center',templet: function (res) {
                                return '<div id="orders'+(res.LAY_TABLE_INDEX)+'" style="line-height: 1px"></div>'
                        }}
                        ,
                        {field: 'speed', title: '速度评分', width: 165, align: 'center',templet: function (res) {
                                return '<div id="speed'+(res.LAY_TABLE_INDEX)+'" style="line-height: 1px"></div>'
                            }}
                        , {field: 'product', title: '产品评分', width: 165, align: 'center',templet: function (res) {
                                return '<div id="product'+(res.LAY_TABLE_INDEX)+'" style="line-height: 1px"></div>'
                        }}
                        , {field: 'enviroment', title: '环境评分', width: 165, align: 'center',templet: function (res) {
                            return '<div id="enviroment'+(res.LAY_TABLE_INDEX)+'" style="line-height: 1px"></div>'
                        }}
                        , {field: 'opinion', title: '建议意见', width: 270, align: 'center',templet: function (res) {
                            if (res.opinion != '' && res.opinion != null){
                                return res.opinion
                            }else {
                                return '暂无建议意见'
                            }

                        }}

                    ]
                ]
                , parseData: function (res) { //res 即为原始返回的数据
                    return {
                        "code": 0, //解析接口状态
                        "msg": res.msg, //解析提示文本
                        // "count": res.data.total, //解析数据长度
                        "data": res.data //解析数据列表
                    }
                }
                ,done:function (res){
                    for (let item in res.data){
                        rate.render({
                            elem: '#service'+item,
                            value: res.data[item].service,
                            readonly: true
                            ,theme: '#a1b1c1' //自定义主题色
                        })
                        rate.render({
                            elem: '#orders'+item,
                            value: res.data[item].service,
                            readonly: true
                            ,theme: '#a1b1c1' //自定义主题色
                        })
                        rate.render({
                            elem: '#speed'+item,
                            value: res.data[item].service,
                            readonly: true
                            ,theme: '#a1b1c1' //自定义主题色
                        })
                        rate.render({
                            elem: '#product'+item,
                            value: res.data[item].service,
                            readonly: true
                            ,theme: '#a1b1c1' //自定义主题色
                        })
                        rate.render({
                            elem: '#enviroment'+item,
                            value: res.data[item].service,
                            readonly: true
                            ,theme: '#a1b1c1' //自定义主题色
                        })
                    }


                }
            });


        });


</script>
<style>
    /*.layui-table-cell{*/
    /*    height: auto;*/
    /*    line-height: 30px;*/
    /*}*/
</style>
</html>